﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;
namespace canyinguanlixitong
{
    public partial class frmas3xiugia1 : Form
    {
        public frmas3xiugia1()
        {
            InitializeComponent();
        }
        public int qww;
        private void frmas3xiugia1_Load(object sender, EventArgs e)
        {
            this.txtname.Text = qww.ToString();
        }
        string str = "Data Source=.;Initial Catalog=Supermarket management system;Integrated Security=True";
        
        //确定
        private void button1_Click(object sender, EventArgs e)
        {
         
            SqlConnection conn = new SqlConnection(str);
            conn.Open();
            try
            {
                string sql = @"update dbo.sangping set sum='"+this.txtsum.Text+"'where id='"+this.txtname.Text+"'";
                SqlCommand comm = new SqlCommand(sql, conn);
                int i = comm.ExecuteNonQuery();
                if (i > 0)
                {
                    MessageBox.Show("修改成功");
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally {
                conn.Close();
            }
        
        }
    }
}
